#include <iostream>
#include<string>
using namespace std;

int main()
{
    string s, ret;
    cin >> s;
    int cur = 0, n = s.size();
    while (cur < n)
    {
        if (ret.size() == 0 || ret.back() != s[cur])ret += s[cur++];
        else
        {
            ret.pop_back();
            cur++;
        }
    }
    ret.size() == 0 ? cout << 0 : cout << ret;


}
